﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Net.Sockets;

namespace University.Workshop.Model
{
    public class TableManager
    {
        public Collection<Table> Tables { get;private set; }
        private static TableManager instance;
     
        public Collection<NetworkStream> AllGames { get; private set; }
        public Collection<string> ActualGames { get; private set; }
        public object Mutex { get; set; }
        public static TableManager Instance { get { if (instance == null)instance = new TableManager(); return instance; } }
        private TableManager()
        {
            Mutex = new object();
            AllGames = new Collection<NetworkStream>();
            Tables=new Collection<Table>();
            ActualGames = new Collection<string>();
            for (int i = 0; i < 5; i++)
            {
                Tables.Add(new Table());
            }
        }
        public void NewGame(NetworkStream stream)
        {
            AllGames.Add(stream);
        }
    }
}
